class Routine {
	constructor() {
		this.scopeUserInfo = 'scope.userInfo';
	}
	async getCode() {
		let provider = await this.getProvider();
		return new Promise((resolve, reject) => {
			uni.login({
				provider: 'weixin',
				success(res) {
					 console.log('登录：',res)
					return resolve(res.code);
				},
				fail(e) {
					return reject(e);
				}
			})
		})
	}
	
	/**
	 * 获取服务供应商
	 */
	getProvider() {
		return new Promise((resolve, reject) => {
			uni.getProvider({
				service: 'oauth',
				success(res) {
					console.log('oauth：',res.provider)
					resolve(res.provider);
				},
				fail() {
					resolve(false);
				}
			});
		});
	}
	
}
export default new Routine();